// 导入
const mongoose = require("../db/db");
// 配置字段的格式
const chatSchema = mongoose.Schema(
  {
    from: {
      type: String,
      require: true,
    },
    to: { type: String, require: true },
    content: { type: String, require: true, default: "" },
    time: {
      type: Date,
    },
  },
  {
    timestamps: false, // 时间戳
    versionKey: false,
  }
);

// 定义模型, 不用写复数
const Chat = mongoose.model("chat", chatSchema);
// 输出模型
module.exports = Chat;
